//
//  TabBarModel.swift
//  BasicTools
//
//  Created by ikang on 2025/8/20.
//

import Foundation
import SwiftUI

public enum BarItemType {
    case system
    case image
    case lottie
}

@Observable public class ItemModel {
    // 文字
    public var title: String = ""
    // 未选中图片
    public var normalImage: String = ""
    // 选中图片
    public var selectImage: String = ""
    
    public init(title: String, normalImage: String = "", selectImage: String = "") {
        self.title = title
        self.normalImage = normalImage
        self.selectImage = selectImage
    }
}

// 统一配置
@Observable public class TabGridModel {
    // TabBar 类型
    public var itemType: BarItemType = .image
    // 文字大小
    public var titleFont: Font = .system(size: 10)
    // 未选中文字颜色
    public var normalTitleColor: Color = .gray
    // 选中文字颜色
    public var selectTitleColor: Color = .red
    // 文字和图片间距
    public var space: CGFloat = 3
    // 图片大小
    public var imageSize: CGSize = CGSize(width: 25, height: 25)
    
    public var gridBackgroundColor: Color = .white
    
    public var gridCornerRadius: CGFloat = 0
    
    // 文字、图片Model数组
    public var itemArr: [ItemModel] = []
    
#if os(iOS)
    public var gridHeight: CGFloat = Define.shared.TabBarHeight - Define.shared.BottomSafeHeight
    public var gridPadding: EdgeInsets = EdgeInsets.init(top: 0, leading: 0, bottom: Define.shared.BottomSafeHeight, trailing: 0)
#else 
    public var gridHeight: CGFloat = 50
    public var gridPadding: EdgeInsets = EdgeInsets.init(top: 0, leading: 0, bottom: 30, trailing: 0)
#endif
    
    public var selectIndex: Int = 0
    
    public init() {}
}

@Observable public class TabBarModel {
    public var gridModel: TabGridModel = TabGridModel()
    // 背景颜色
    public var backgroundColor: Color = .white
#if os(iOS)
    public var padding: EdgeInsets = EdgeInsets.init(top: 0, leading: 0, bottom: Define.shared.BottomSafeHeight, trailing: 0)
#else 
    public var padding: EdgeInsets = EdgeInsets.init(top: 0, leading: 0, bottom: 30, trailing: 0)
#endif
    
    public init() {}
}


